#!/usr/bin/env perl
use 5.10.0;
use strict;

#读取一些列单词
chomp(my @worlds = <STDIN>);

my %result;
#打印每个单词出现的次数
for my $w (@worlds) {
    my $val = $result{$w};
    if (defined($val)) {
        $result{$w} = $val + 1;
    } else {
        $result{$w} = 1;
    }
}

for my $key (sort keys %result) {
    print "$key, $result{$key} \n";
}
